#!/bin/bash

echo "开始构建 Docker 镜像..."
docker compose build  # 使用 "docker compose" 替代 "docker-compose"

if [ $? -eq 0 ]; then
    echo "镜像构建成功，开始启动容器..."
    docker compose up -d  # 同理调整此处
    
    if [ $? -eq 0 ]; then
        echo "容器启动成功！"
        echo "使用以下命令查看容器状态:"
        echo "docker compose ps"
    else
        echo "容器启动失败！"
        exit 1
    fi
else
    echo "镜像构建失败！"
    exit 1
fi
